package intelligentrecommender.phases.test;

import edu.stanford.nlp.ling.TaggedWord;
import edu.stanford.nlp.ling.WordLemmaTag;
import edu.stanford.nlp.ling.WordTag;
import edu.stanford.nlp.parser.lexparser.LexicalizedParser;
import edu.stanford.nlp.process.Morphology;
import edu.stanford.nlp.process.PTBTokenizer;
import edu.stanford.nlp.tagger.maxent.ExtractorFrames;
import edu.stanford.nlp.tagger.maxent.ExtractorFramesRare;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
import edu.stanford.nlp.trees.Tree;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * This demo shows user-provided sentences (i.e., {@code List<HasWord>}) being
 * tagged by the tagger. The sentences are generated by direct use of the
 * DocumentPreprocessor class.
 *
 * @author Christopher Manning
 */
class TaggerDemo2 {

    private TaggerDemo2() {
    }

    public static void main(String[] args) throws Exception {
        String input = "My name is Eias.";
        /*MaxentTagger tagger = new MaxentTagger("src/intelligentrecommender/phases/test/models/wsj-0-18-left3words.tagger");
         //TokenizerFactory<CoreLabel> ptbTokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), "untokenizable=noneKeep");
         //BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[1]), "utf-8"));
         //PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, "utf-8"));

         //DocumentPreprocessor documentPreprocessor = new DocumentPreprocessor("");
         //documentPreprocessor.setTokenizerFactory(ptbTokenizerFactory);
         String tagged = tagger.tagString(input);
         System.out.println(tagged);
         //String splits[] = tagged.split(" ");
         for (String word : tagger.tagString(input).split(" ")) {
         if (word.contains("_VBP")) {
         System.out.println(word);
         }
         }*/

        /*String[] options = {"-maxLength", "80", "-retainTmpSubcategories"};
         LexicalizedParser lp = LexicalizedParser.loadModel("edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz", options);

         Tree taggedWords = (Tree) lp.apply(input);
         for (Tree tw : taggedWords) {
         if (tw.value().startsWith("N") || tw.value().startsWith("J")) {
         System.out.println(tw.getLeaves());
         }
         }*/

        /*String[] options = {"-maxLength", "80", "-retainTmpSubcategories"};
         LexicalizedParser lp = LexicalizedParser.loadModel("edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz", options);
         Tree parse = (Tree) lp.apply(input); // finally, we actually get to parse something
         for (TaggedWord tw : parse.taggedYield()) {
         System.out.println(tw.word() + " * " + tw.tag());
         }*/

        try {
            MaxentTagger tagger = new MaxentTagger("src/intelligentrecommender/phases/test/models/wsj-0-18-left3words.tagger");
             
        } catch (IOException | ClassNotFoundException ex) {
        }
    }
}
